//
//  HMTopILView.m
//  HowToDo
//
//  Created by 胡坤 on 2017/1/4.
//  Copyright © 2017年 KY. All rights reserved.
//

#import "HMTopILView.h"

@interface HMTopILView ()


@end

@implementation HMTopILView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        [self setUPUI];
    }
    return self;
}


-(void)setImg:(UIImage *)img Title:(NSString *)title 
{
    self.imgView.image = img;
    self.titleLable.text = title;
   
}
-(void)setUPUI
{
    [self addSubview:self.imgView];
    
    [self addSubview:self.titleLable];
    

    [self.titleLable mas_makeConstraints:^(MASConstraintMaker *make)
    {
        make.centerX.equalTo(self);
        make.bottom.equalTo(self);
    }];
    
    [self.imgView mas_makeConstraints:^(MASConstraintMaker *make)
    {
        make.bottom.equalTo(self.titleLable.mas_top);
        make.left.right.top.equalTo(self);
    }];
}


- (UIImageView *)imgView
{
    if (!_imgView)
    {
        _imgView = [[UIImageView alloc]init];
        _imgView.contentMode = UIViewContentModeScaleAspectFit;
    }
    return _imgView;
}

- (UILabel *)titleLable
{
    if (!_titleLable)
    {
        _titleLable = [[UILabel alloc]init];
    }
    return _titleLable;
}

@end
